Update JSX intrinsic element test to match babel’s#19946
Merged
mhegazy merged 4 commits intomicrosoft:masterfrom Nov 14, 2017
Merged
Update JSX intrinsic element test to match babel’s#19946mhegazy merged 4 commits intomicrosoft:masterfrom
mhegazy merged 4 commits intomicrosoft:masterfrom
Conversation
RyanCavanaugh
approved these changes
Nov 12, 2017
RyanCavanaugh
requested changes
Nov 12, 2017
Member
RyanCavanaugh
left a comment
There was a problem hiding this comment.
Looks like you missed a baseline
Contributor
Author
|
@RyanCavanaugh updated, thanks! |
mhegazy
reviewed
Nov 13, 2017
| // An escaped identifier had a leading underscore prior to being escaped, which would return true | ||
| // The escape adds an extra underscore which does not change the result | ||
| const ch = (name as string).substr(0, 1); | ||
| return ch.toLowerCase() === ch; |
Contributor
There was a problem hiding this comment.
ch.toLowerCase() === ch || ch === "_" ?
Contributor
There was a problem hiding this comment.
aah.. that is the opposite.. sorry..
Contributor
There was a problem hiding this comment.
const ch = (name as string).charCodeAt(0);
return (ch >= CharacterCodes.a && ch <= CharacterCodes.z) ||
ch == CharacterCodes._ ||
(name as string).indexof("-") > 0;
Contributor
There was a problem hiding this comment.
and avoid the creation of a regexp on every invocation.
Contributor
Author
There was a problem hiding this comment.
oops, missed the comment before. Updating…
RyanCavanaugh
approved these changes
Nov 14, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR changes the intrinsic element check in src/compiler/utilities.ts#L2436 to use babel’s instead.
Fixes #19945
Babel’s JSXElement name test: babel-types/src/react.js#L5-L7
This PR undoes some of the changes added by #16915 and makes the
doubleUnderscoreReactNamespacetest redundant. Might be good to get input from @weswigham (?)